package com.devunion.salon.client.app.mvc.controller;

import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.devunion.salon.client.app.mvc.view.ProductView;
import com.devunion.salon.client.app.mvc.SalonEvents;

/**
 * @author spetrakovsky
 */
public class ProductController extends Controller {

    private ProductView productView;

    public ProductController() {
        registerEventTypes(SalonEvents.NAVIGATE_PRODUCT_VIEW);
    }

    @Override
    protected void initialize() {
        super.initialize();
        productView = new ProductView(this);
    }

    public void handleEvent(AppEvent<?> event) {
        if (event.type == SalonEvents.NAVIGATE_PRODUCT_VIEW) {
            forwardToView(productView, event);
        }
    }
}
